import { RouterItem } from '@/types'
import Project from '@/pages/project'
import { RouteObject } from 'react-router-dom'

const orginRoutes: RouterItem[] = [
  {
    title: '项目管理',
    path: '/',
    icon: 'i-mdi:airballoon',
    component: <Project />,
    children: []
  }
]

const transeToRoutes = (routes: RouterItem[]): RouteObject[] => {
  return routes.map((item) => {
    return {
      path: item.path,
      element: item.component,
      children: transeToRoutes(item?.children || [])
    }
  })
}

export default transeToRoutes(orginRoutes)
